package com.pxl.springbootinit.mapper;

import com.pxl.springbootinit.model.entity.ChatMessage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author MADAO
* @description 针对表【chat_message(即时通讯表)】的数据库操作Mapper
* @createDate 2024-12-20 11:59:03
* @Entity com.pxl.springbootinit.model.entity.ChatMessage
*/
public interface ChatMessageMapper extends BaseMapper<ChatMessage> {

    @Select("SELECT receiver_id AS user_id FROM chat_message" +
            " WHERE sender_id = #{userId}\n" +
            "UNION\n" +
            "SELECT sender_id AS user_id\n" +
            "FROM chat_message\n" +
            "WHERE receiver_id = #{userId} and is_deleted = 0;\n")
    List<Long> listChatWithUser(Long userId);
}




